local typedefs = require "kong.db.schema.typedefs"

local is_present = function(v)
    return type(v) == "string" and #v > 0
end

return {
    name = "   ",
    fields = {
        { protocols = typedefs.protocols_http },
        { config = {
            type = "record",
            fields = {
                { allow_http_log = {
                    type = "boolean",
                    default = true,
                    required = true }, },
                { http_method = {
                    type = "string",
                    default = "POST",
                    required = true }, },
                { http_timeout = {
                    type = "integer",
                    default = 2000,
                    required = true }, },
                { http_host = {
                    type = "string",
                    default = "127.0.0.1",
                    required = true }, },
                { http_keepalive = {
                    type = "integer",
                    default = 10000,
                    required = true }, },
                { http_content_type = {
                    type = "string",
                    default = "application/json",
                    required = true }, },
                { http_parsed_url = {
                    type = "string",
                    default = "www.baidu.com",
                    required = true }, },
                { http_port = {
                    type = "integer",
                    default = 1234,
                    between = { 1, 10000 },
                    required = true }, },
                { allow_identify = {
                    type = "boolean",
                    default = true,
                    required = true
                }, },
                { identify_url = {
                    type = "string",
                    default = "test",
                    required = false
                }, },
                { identify_msg_code = {
                    type = "integer",
                    default = 41009,
                    required = true
                }, },
            },
        },
        },
    },
}
